Skip to content

Conversation

@iam404
Copy link
Member

@iam404 iam404 commented Oct 10, 2025

Cleanup & Pre-release Checks

Summary

This PR completes the tfe → pytfe rename, finalizes the modular model layout under pytfe/models/, and hardens the transport and resources to prep for GA. Highlights:

  • Switch imports to pytfe across source, tests, and examples.
  • Split the former monolithic types.py into cohesive domain modules under pytfe/models/ (with a new common.py).
  • Establish a curated public facade via pytfe/models/__init__.py (no more dynamic loaders).
  • Align resource option handling and examples with the new model layout.
  • Pre-GA transport cleanup (headers, config surfaces), plus follow-ups called out below.

Notable Changes

1) Package rename & public surface

  • All imports moved from tfepytfe.
  • src/pytfe/__init__.py exposes a minimal, stable surface: TFEClient, TFEConfig, errors, models.
  • pyproject.toml: distribution name set to pytfe, wheel target src/pytfe, sdist include list updated.
  • Examples/tests updated to import from the new namespace.

2) Model refactor (types split → modules)

Why: smaller units, clearer ownership, better testability, fewer circulars.

  • pytfe/models/common.py: shared primitives & small types (e.g., enums, pagination, tag-related helpers) to avoid duplication and cross-module import cycles.
  • Configuration versionsmodels/configuration_version.py (includes ConfigurationVersion* models, IngressAttributes, and ConfigVerIncludeOpt).
  • Data retention policymodels/data_retention_policy.py (policy + set options + choice union).
  • Workspacesmodels/workspace.py (workspace DTOs, options, include enums, VCSRepo, LockedByChoice, etc.).
  • Projects / Variables / Variable sets / Registry modules / Providers / OAuth / Agents / SSH keys / Reserved tag keys / Query runs split into corresponding domain modules.
  • models/__init__.py: curated, explicit re-exports from domain modules; removed dynamic importlib loader that used to reflect a flat types.py.

Foundation: All new types live in a domain module under pytfe/models/ and are re-exported intentionally from pytfe/models/__init__.py. No dynamic imports.

3) Transport groundwork

  • Unified User-Agent string set to pytfe/<version>.
  • Transport constructor kept stable; follow-up below to finalize proxy handling.

Foundations for the Team (to keep going forward)

  1. Module boundaries & re-exports

    • Domain modules own their types.
    • pytfe/models/__init__.py is the only public exporter—keep it curated and alphabetized.
    • No dynamic type loading.
  2. Transport contracts

    • All services depend on a single HTTPTransport. (No Async)

Testing

  • Unit tests updated to pytfe imports and new model paths.

Appendix: Example import patterns

# Public surface for users
from pytfe import TFEClient, TFEConfig
from pytfe.models import WorkspaceCreateOptions, Workspace

# Internal (inside the package), relative imports from defining modules
from ..models.workspace import WorkspaceListOptions

@iam404 iam404 requested a review from a team as a code owner October 10, 2025 04:35
@isivaselvan isivaselvan merged commit 0a5bc6e into main Oct 10, 2025
11 checks passed
@iam404 iam404 deleted the TF-31174 branch October 28, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants